<?php
/**
 * Created by PhpStorm.
 * User: lgy
 * Date: 2018/5/25
 * Time: 21:29
 */

namespace app\index\model;
use think\Db;
use think\Model;

class Index extends Model
{
	public static function addEnroll($params){
		$data = [
			'area'=>$params['area'],
			'shop'=>$params['shop'],
			'phone'=>$params['phone'],
			'create_time'=>time()
		];
      	$result = Db::table('dbkj_enroll')->insert($data);
      	$thisWek = mktime(0, 0 , 0,date("m"),date("d")-date("w")+1,date("Y"));
      	$condition = [
        	'create_time'=>['>=',$thisWek],
          	'area'=>$params['area']
        ];
		$count = Db::table('dbkj_enroll')->where($condition)->count();
      	if($count > 5){
        	return false;
        }
		return false;
	}
	public static function addorder($params){
		$data = [
			'area'=>$params['area'],
			'shop'=>$params['shop'],
			'phone'=>$params['phone'],
			'style'=>$params['style'],
			'meituan'=>$params['meituan'],
			'elema'=>$params['elema'],
			'changelic'=>$params['changelic'],
			'create_time'=>time()
		];
		$result = Db::table('dbkj_order')->insert($data);
		return $result;
	}
}